<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>文件管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/systemStatic/style/admin.css">
    <link rel="stylesheet" href="${ctx}/extends/zTree_v3/css/zTreeStyle/zTreeStyle.css"/>
    <link rel="stylesheet" href="${ctx}/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/css/public.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
</head>
<body>
<div style="position: relative;height: 100%;">
    <input type="hidden" value="" name="treeLj">
    <div class="ccpui-trees" style="width: 380px;">
        <div style="margin-top: 6px;">
            <ul class="ccpui-iconTree iconTrees">
                <li><a class="iconfont iconshuaxin- zTrees-refresh" title="刷新"></a></li>
                <li><a class="iconfont iconwenjianjia1-copy zTrees-triangle-d" title="展开"></a></li>
                <li><a class="iconfont iconfolder1 zTrees-triangle-r" title="收起"></a></li>
            </ul>
            <ul id="treeLj" class="ztree ccpui-listZtree" style="top: 40px;"></ul>
        </div>
    </div>
</div>

<script src="${ctx}/extends/jquery.min.js" type="text/javascript"></script>
<script src="${ctx}/public/component.js" type="text/javascript"></script>
<script src="${ctx}/layui/layui.js"></script>
<script src="${ctx}/extends/zTree_v3/js/jquery.ztree.all.min.js" type="text/javascript"></script>
<script src="${ctx}/extends/zTree_v3/js/jquery.ztree.exhide.min.js" type="text/javascript"></script>
<script>
    layui.config({
        base: serverPath.systemPath + staticPath.systemPath //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index', 'setter', 'commons', 'form', 'jquery', 'layer', 'common', 'table', 'totalFilter'], function () {
        var table = layui.table, layer = layui.layer, setter = layui.setter, commons = layui.commons,
            common = layui.common, totalFilter = layui.totalFilter, form = layui.form, $ = layui.jquery;
        var treeLj={//全局变量集合
            parentType:'1' //初始化treetype参数  1物理树目录节点 2逻辑归类树目录节点
            ,nowTreeNodeid:'' //当前单击树节点id
            ,nowTreeNodeinfo : ''//当前节点信息
            ,nowRightTreeNodeid:'' //当前右键树节点id
            ,nowRightTreeNodeinfo : ''//当前右键节点信息
        };
        //展开
        $(".iconTrees .zTrees-triangle-d").click(function () {
            $.fn.zTree.getZTreeObj("treeLj").expandAll(true);
        });
        //收起
        $(".iconTrees .zTrees-triangle-r").click(function () {
            $.fn.zTree.getZTreeObj("treeLj").expandAll(false);
        });
        //刷新
        $(".iconTrees .zTrees-refresh").click(function () {
            fileZtree({treeType:'2'});//初始化树
        });
        fileZtree({treeType:'2'});//初始化树
        function fileZtree(datajson) {
            $.ajax({
                url: serverPath.systemPath + setter.sysLinkPath + "fileManagement/mappingTree",
                type: "get",
                contentType: 'application/json',
                dataType: 'json',
                async:false,
                success: function (data) {
                    var zNodes = data.data;
                    var setting = {
                        data: {
                            simpleData: {
                                enable: true,
                            }
                        },
                        callback: {
                            onClick: onClickRoles,
                        }
                    };
                    $.fn.zTree.init($('#treeLj'), setting, zNodes);
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.alert("暂无数据，请稍后操作！" + XMLHttpRequest.status);
                },
            });
        }
        function onClickRoles(event, treeId, treeNode, clickFlag) {
            treeLj.nowTreeNodeid = treeNode.id;
            treeLj.nowTreeNodeinfo = treeNode;//当前节点信息
            $("input[name=treeLj]").val(treeNode.id);
        }
    });
</script>
</body>
</html>
<link rel="stylesheet" href="${ctx}/css/font/iconfontie.css" media="all"/>
<link rel="stylesheet" href="${ctx}/iconfont/iconfont.css"/>